package smartcarpool.ui;

import com.example.smartcarpool.R;

import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;

public class EditTextListenerSC extends FragmentActivity implements OnClickListener {

	private FragmentManager fragmentManager;
	private View view;

	public EditTextListenerSC(FragmentManager fm, View vw) {
		this.fragmentManager = fm;
		this.view = vw;
	}

	@Override
	public void onClick(View editText) {
		// TODO Auto-generated method stub
		EditText editLine = (EditText) editText;
		
		if ((editText == this.view.findViewById(R.id.editText4)) || (editText == this.view.findViewById(R.id.editText6)))
				{
			Log.d("App Info", "Call Time picker");
	    	DialogFragment newFragment = new TimePickDialog(editLine);
	    	newFragment.show(fragmentManager, "timePicker");
	    
		} else {
			Log.d("App Info", "Call Date picker");
	    	DialogFragment newFragment = new DatePickDialog(editLine);
	    	newFragment.show(fragmentManager, "datePicker");
		}
	}
}
